package com.histone.heartbeat.pojo.resp;

import lombok.Data;

@Data
public class ResultBean<T> {
    private int errCode;
    private String errMsg;
    private T result;

    public ResultBean(T result) {
        this.errCode = ErrorCode.OK.ordinal();
        this.result = result;
    }

    public ResultBean(ErrorCode errorCode, String errMsg) {
        this.errCode = errorCode.ordinal();
        this.errMsg = errMsg;
    }

    public ResultBean(ErrorCode errorCode, T result, String errMsg){
        this.errCode = errorCode.ordinal();
        this.errMsg = errMsg;
        this.result = result;
    }

    public enum ErrorCode {
        OK, NULL, ERROR
    }

}
